Repository navigation
feat(plugins): add auto_install option and auto-install gopls, rust-analyzer, ocaml-lsp, biome, oxlint - #154
Conversation
Each plugin declares userConfig.auto_install (boolean, default true) and gates its npm SessionStart install hook on it.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request introduces a configurable 'Auto-install language server' option (auto_install) across various LSP server plugins, allowing users to disable session-start installations and updates. The feedback highlights critical correctness and robustness issues: the auto-installed ocamllsp will fail to run without a wrapper script or opam exec because it is not added to the system PATH, and the environment variable check for CLAUDE_PLUGIN_OPTION_AUTO_INSTALL should be case-insensitive. Additionally, several shell scripts and hooks contain unsafe path checks that could resolve to root-level directories if CLAUDE_PLUGIN_DATA is empty or unset, which should be guarded with non-empty checks.
[Medium impact] The PR appears safe to merge; the previous OCaml launch issue is fixed, and no new actionable issues were found. SummaryAdds an
Reviews (2) · Last reviewed commit: "chore(plugins): apply AI code review sug..." · Reviewed by Greptile |
There was a problem hiding this comment.
1 issue found across 37 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="ARCHITECTURE.md">
<violation number="1" location="ARCHITECTURE.md:202">
P2: This blanket data-directory claim is inaccurate for rust-analyzer and ocamllsp: their hooks install into the active Rust toolchain and opam switch, not `$CLAUDE_PLUGIN_DATA`. Limit the data-directory statement to npm-based plugins and describe the other servers as toolchain installs.</violation>
</file>
Architecture diagram
sequenceDiagram
participant User as Claude Code User
participant CC as Claude Code
participant Plugin as LSP Plugin
participant Hook as SessionStart Hook
participant Data as Plugin Data Dir
participant PM as Package Manager (npm/go/rustup/opam)
Note over User,PM: LSP Plugin Session-Start Auto-Install Flow
User->>CC: Start session
CC->>Plugin: Load plugin manifest
Plugin->>Plugin: Check auto_install option
alt auto_install = true (default)
Note over Plugin: accept true or any value except false|0|no|off
Plugin->>Hook: Run SessionStart hook
Hook->>Data: Check existing install state
alt npm-based server
Hook->>PM: npm install into CLAUDE_PLUGIN_DATA
PM-->>Hook: Dependencies installed
else go install (gopls)
Hook->>PM: GOBIN=... go install golang.org/x/tools/gopls@latest
PM-->>Hook: gopls binary installed
else rustup component add (rust-analyzer)
Hook->>PM: rustup component add rust-analyzer
PM-->>Hook: Component installed
else opam install (ocaml-lsp)
Hook->>PM: opam install -y ocaml-lsp-server
PM-->>Hook: ocamllsp installed
end
Hook-->>Data: Update package/data
else auto_install = false|0|no|off
Note over Plugin: Skip install entirely
Plugin-->>CC: Server runs from data dir only
end
CC->>Plugin: Start LSP server (per file type)
alt gopls via wrapper script
Plugin->>PM: Check PATH for gopls
alt gopls on PATH
PM-->>Plugin: Use PATH gopls
else gopls in data dir
Plugin->>Data: Use $CLAUDE_PLUGIN_DATA/bin/gopls
end
else biome/oxlint via wrapper
Plugin->>PM: Check project-local node_modules
alt project-local found
PM-->>Plugin: Use project binary
else check PATH
Plugin->>PM: Check PATH binary
alt PATH found
PM-->>Plugin: Use PATH binary
else fallback to data dir
Plugin->>Data: Use $CLAUDE_PLUGIN_DATA/node_modules/.bin/binary
end
end
else direct server command
Plugin-->>CC: Launch server directly (rust-analyzer, ocamllsp)
end
Plugin-->>CC: LSP server ready
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
- Launch ocaml-lsp through scripts/lsp.sh with an `opam exec --` fallback, and skip the install when the switch already provides ocamllsp - Match the auto_install opt-out case-insensitively - Reinstall biome/oxlint when the manifest matches but the binary is gone - Guard every install hook and wrapper against an empty CLAUDE_PLUGIN_DATA - Correct where toolchain-based servers install in ARCHITECTURE.md
|
/gemini review |
|
Code Review ✅ Approved 🟡 Medium riskNew session-start hooks install language servers through Go, rustup, opam, and npm, changing local toolchains and plugin data and potentially delaying startup. Adds an VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Important Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
There was a problem hiding this comment.
Code Review
This pull request introduces a configurable auto-installation mechanism for LSP server plugins. It adds an auto_install user configuration option (defaulting to true) across all plugin configurations (plugin.json), allowing users to disable automatic session-start installations. The installation hooks in the plugins are updated to respect this setting. Additionally, specific toolchain-based auto-installations are implemented: gopls via go install, rust-analyzer via rustup component add, and ocaml-lsp via opam install. Dedicated fallback installations and wrapper scripts (lsp.sh) are also introduced for biome-lsp and oxlint-lsp. Documentation in README.md and ARCHITECTURE.md has been updated to reflect these changes. There are no review comments to assess, and we have no further feedback to provide.



Summary
LSP plugins that already ran a SessionStart
npm installinto${CLAUDE_PLUGIN_DATA}had no way to opt out, and several others (gopls, rust-analyzer, ocaml-lsp, biome, oxlint) required a manually installed binary. This PR adds anauto_installoption to the plugins that install at session start and extends auto-install to those five.What changed
userConfig.auto_install(boolean, default true). The hook is wrapped incase "${CLAUDE_PLUGIN_OPTION_AUTO_INSTALL:-true}" in false|0|no|off) ;; *) <existing> ;; esac, so turning it off in/configskips session-start installs and updates.go install golang.org/x/tools/gopls@latestinto the data dir when gopls is missing and Go is on PATH. Newscripts/lsp.shprefers PATH gopls, then the data-dir copy.rustup component add rust-analyzerwhen it cannot run and rustup exists.opam install -y ocaml-lsp-serverwhen ocamllsp is missing and opam exists.package.json(@biomejs/biome2.6.2, same pin aspackages/lspBIOME_VERSION;oxlint1.94.0).lsp.shfalls back to the data-dir binary after project-local and PATH.plugins/section updated, including the stale plugin count (33 LSP plugin dirs, 27 with package.json).Scope
code lsp-server(clangd, kotlin, dart, ...) are not gated by this option. That needs apackages/lspchange and a release.Tradeoffs and risks
Verification
claude plugin validatepasses for all 34 plugin directories.rustup component addandopam install(avoided mutating local toolchains; opam not installed).Related issue
No linked issue.
Checklist
bun run test) — no test covers plugin manifests; none addedbun run lint) — not runBREAKING CHANGE:note is includedSummary by cubic
Adds an
auto_installoption so LSP plugin users can turn off session-start installs, and extends auto-install to gopls, rust-analyzer, ocaml-lsp, biome, and oxlint.Changes
auto_install(default true), read asCLAUDE_PLUGIN_OPTION_AUTO_INSTALL; false/no/off/0 opt out case-insensitively, and hooks skip whenCLAUDE_PLUGIN_DATAis unset.go install,rustup component add,opam install). The gopls and ocaml-lsp wrappers prefer a PATH binary, then fall back to the data-dir copy oropam exec -- ocamllsp.package.jsondeps (@biomejs/biome2.6.2,oxlint1.94.0). Their hooks reinstall when the binary is missing, and the wrappers fall back to the data-dir binary after project-local and PATH.code lsp-serverruntime downloads (clangd, kotlin, dart) are not gated.Notes
Written for commit 42cfa68. Summary will update on new commits.